class Account::OrdersController < Account::BaseController

  def index
    if params[:page]
      @page = params[:page].to_i
    else
      @page = 1
    end
    
    @orders = Order.find_all_by_user_id(@account.id, :limit => 3, 
                                                     :offset => @page * 3 - 3,
                                                     :order => 'created_at DESC')

    @orders_count = Order.count('user_id', :conditions => {:user_id => @account.id})
    @pages = (@orders_count.to_f/3.to_f).ceil

  end

end